package com.org.Bibliotech;

/**
 * Created by Joshua on 6/7/2014.
 */
public class Book {
    private String title;
    private String author;
    private int publicationYear;
    private Customer owner;

    public Book(String title, String author, int year ){
        this.title = title;
        this.author = author;
        this.publicationYear = year;
        owner = null;
    }


    public void setOwner(Customer owner){
        this.owner = owner;
    }

    public void returnBook(){
        owner = null;
    }

    public Customer getOwner(){
        return owner;
    }
    public boolean equals(Object _book){

        Book book;

        try {
            book = (Book) _book;
        } catch(Exception e){
            return false;
        }
        return title.equals(book.title) &&
                author.equals(book.author) &&
                (publicationYear == book.publicationYear);
    }


    public String getAuthor(){
        return author;
    }

    public String getTitle(){
        return title;
    }

    public int getPublicationYear(){
        return publicationYear;
    }

    public String getDetails(){

        return "Title: " + title +'\n' +
                "Author: " + author + '\n' +
                        "Publication Year: " + publicationYear;
    }


}
